package com.server.llh.llhserverwork.view;

import android.app.Activity;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.llh.llhsuppliers.R;
import com.server.llh.llhserverwork.bean.Constants;
import com.server.llh.llhserverwork.bean.ShowProInfoBean;
import com.squareup.picasso.Picasso;

/**
 * Created by ZTF on 2017/3/20.
 * 商品，服务，餐品，显示详细信息工具类
 */

public class ShowProInfoView {
    public static MyPopupWindow myPopupWindow=null;
    public static  void showProInfo(ShowProInfoBean showProInfo, View v, Activity context){
        LinearLayout llhDetailLayout = (LinearLayout) LayoutInflater
                .from(context).inflate(R.layout.llh_pro_detail_layout, null);
        TextView mealTime = (TextView) llhDetailLayout
                .findViewById(R.id.mealTime);
        TextView proName = (TextView) llhDetailLayout
                .findViewById(R.id.proName);
        TextView remark = (TextView) llhDetailLayout.findViewById(R.id.remark);
        TextView proPrice = (TextView) llhDetailLayout
                .findViewById(R.id.proPrice);
        ImageView image = (ImageView) llhDetailLayout.findViewById(R.id.image);

        proName.setText("服务名：" + showProInfo.getProName());
        remark.setText("描述：" + showProInfo.getProRemark());
        proPrice.setText("价格：" + showProInfo.getPrice() + "元");
        mealTime.setText("好评率:100%");
        if (showProInfo.getImgUrl()!=null) {
            Picasso.with(context).load(Constants.SER_IMAGE_URL+showProInfo.getImgUrl()).into(image);
        } else {
            image.setImageResource(R.drawable.icon_launcher);
        }

        myPopupWindow = new MyPopupWindow(context,llhDetailLayout, 1);
        // 显示窗口
        myPopupWindow.showAtLocation(v,Gravity.CENTER, 0, 0);
    }

}
